package com.arlen;

import com.arlen.mapper.LoginMapper;
import com.arlen.pojo.TUser;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.junit4.SpringRunner;

@SuppressWarnings("all")
@SpringBootTest(classes = SecurityApplication.class)
@RunWith(SpringRunner.class)
public class Bcay {


    @Autowired
    LoginMapper loginMapper;

    @Autowired
    BCryptPasswordEncoder bCryptPasswordEncoder;

    @Test
    public void show01(){
        String encode = bCryptPasswordEncoder.encode("123");
        TUser user = TUser.builder().userName("admin").passWord(encode).id(2).build();
        loginMapper.insert(user);
    }

}
